package edu.sctu.zhoumengxue.day201506.day20150602;
import java.util.HashMap;
/**
 * Created by user12 on 2015/6/2.
 *//*地铁卡处理类*/
public class CardDeth {

    private HashMap<String,Integer> map;
    public CardDeth(){}
    /*构造函数*/
    public CardDeth(HashMap<String, Integer> map){

        this.map = map;

    }
/*获取经过多少站*/
    public int getCount(String start,String end){
        int count = 0;
        if(map.get(start)>map.get(end)){
            count = map.get(start)-map.get(end);
        }else {
            count = map.get(end)-map.get(start);
        }
        return count;
    }
/*计算价格*/
    public int getPrice(String start,String end){
        int price = 2;
        if(getPrice(start,end)<3){
            price = 2;
        }else if(getPrice(start,end)>=3 && getPrice(start,end)<6){
            price = 4;
        }else if(getPrice(start,end)>=6 && getPrice(start,end)<8){
            price = 5;
        }else if(getPrice(start,end)>=8){
            price = 6;
        }
        return price;
    }
    /*充值金额*/

    public void setPrice(int price,PeopleAppbean people){

        people.setPrice(people.getPrice()+price);
    }

}
